#ifndef __RAY_H__
#define __RAY_H__
#include "vec3.h"
#include <limits>

class Ray {
public:
    Ray(const Vec3f& p, const Vec3f& d, 
        float t = 0.0f, float max = std::numeric_limits<float>::infinity()) noexcept
        : dir(d), origin(p), time(t), tMax(max) { }

    Vec3f at() const noexcept {
        return origin + dir * time;
    }

    Vec3f dir = Vec3f{};
    Vec3f origin = Vec3f{};
    float time = 0.0f;
    mutable float tMax = std::numeric_limits<float>::infinity();
};

#endif